﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.DistritosPersonal
{
	/// <summary>
	/// 
	/// </summary>
	public class DistritoPersonalByDistritoSpecification
		: Specification<DistritoPersonal>
	{

		#region Private properties

		/// <summary>
		/// 
		/// </summary>
		private Guid _distritoGuid = default(Guid);

		#endregion

		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		/// <param name="distritoGuid"></param>
		public DistritoPersonalByDistritoSpecification(Guid distritoGuid)
		{
			if (distritoGuid == Guid.Empty)
				throw new InvalidOperationException(Messages.exception_InvalidArgument);
			_distritoGuid = distritoGuid;
		}

		#endregion

		#region Specification overrides

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public override System.Linq.Expressions.Expression<Func<DistritoPersonal, bool>> SatisfiedBy()
		{
			Specification<DistritoPersonal> specification = new TrueSpecification<DistritoPersonal>();
			specification &= new DirectSpecification<DistritoPersonal>(personal => personal.DistritoGuid == _distritoGuid);
			return specification.SatisfiedBy();
		}

		#endregion

	}
}
